<#assign notOneEntity = parameters.columns.size() gt 0>

<#if (parameters.items.size()>0)>
<table class="datagrid" border=0 cellpadding=0 cellspacing=0>
	<thead>
	<tr>
		<th>
			<#assign textModel = parameters.textModel?default('false')/>
			<#assign isTextModel = textModel == 'true' || textModel == 'both'/>
			<#if !isTextModel>
				<a href="#" onclick="addRow(this, true);return false;">+</a>&nbsp;
			</#if>
		</th>
		<#if notOneEntity>
			<#list parameters.columns as column>
			<#if column.visible>
				<th>
					<@s.text name="${column.label}"/>
					<#if column.isRequired()>
						<span class="required">*</span>
					</#if>
			  	</th>
		  	</#if>
		  	</#list>
		<#else>
			<th>&nbsp;</th>
		</#if>
	</tr>
	</thead>
	
	<tbody>
	<#list parameters.items as data>
		${stack.push(data)}
		<tr>
			<td>
				<#if !isTextModel>
					<a href="#" onclick="addRow(this);return false;">+</a>&nbsp;
					<a href="#" onclick="removeRow(this);return false;">-</a>
				</#if>
			</td>
		
			<#if notOneEntity>
				<#list parameters.columns as column>
				<#if column.visible>
					<td valign="bottom">
						<@cs.element name="${column.getName(data_index)}"
							 		value="%{${column.shortName}}" theme="simple"/>
					</td>
				<#else>
					<@cs.element name="${column.getName(data_index)}"
									value="%{${column.shortName}}" theme="simple"/>
				</#if>
			    </#list>
		    <#else>
		    	<td valign="bottom">${data}</td>
		    </#if>
		</tr>
		<#assign temp = stack.pop()>
	</#list>
	</tbody>
</table>
</#if>